package com.zhtools.excel.tester;

import com.zhtools.excel.Column;
import com.zhtools.excel.Formater;
import com.zhtools.excel.export.SimpleExcelExport;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class SimpleExcelExport4 extends SimpleExcelExport<Order> {
    private List<Order> datas = new ArrayList<>();

    @Override
    protected List<Column> createHeaders() {
        List<Column> columns = new ArrayList<>();
        columns.add(new Column("订单ID", "orderId", ""));
        columns.add(new Column("订单编号", "orderCode", ""));
        columns.add(new Column("订单价格", "price", ""));
        columns.add(new Column("下单时间", "createTime", ""));
        columns.add(new Column("订单评价", "score", ""));
        columns.add(new Column("订购商品", "orderItem", "", new Formater<OrderItem>() {
            @Override
            public String format(OrderItem orderItem) {
                return orderItem.getTitle() + "|" + orderItem.getAmount() + "|" + orderItem.getPrice();
            }
        }));
        return columns;
    }

    public static void main(String[] args) {
        SimpleExcelExport4 simpleExcelExport = new SimpleExcelExport4();
        simpleExcelExport.multiThreadExport(new PageExport1(), new File("/Users/zhanghao/测试4.xlsx"));
    }
}
